# Contributor: MathxH Chen <brainfvck@foxmail.com>
# Maintainer: MathxH Chen <brainfvck@foxmail.com>
pkgname=bigbang
pkgver=0.0.4
pkgrel=4
pkgdesc="The core node of bigbang blockchain network"
url="https://github.com/BigBang-Foundation/BigBang"
# x86, armv7, armhf, ppc64le - PoW Hash algorithm does not support 32-bit or powerpc at present
# s390x - tests fail
arch="x86_64 aarch64"
license="MIT"
makedepends="
	cmake
	python3
	boost-dev
	openssl-dev
	readline-dev
	ncurses-dev
	libsodium-dev
	libexecinfo-dev
	leveldb-dev
	samurai
	snappy-dev
	"
# cmakelists.patch force use dynamic libs.
source="$pkgname-$pkgver.tar.gz::https://github.com/BigBang-Foundation/BigBang/archive/v$pkgver.tar.gz
	cmakelists.patch
	gcc11.patch
	werror.patch
	"
builddir="$srcdir/BigBang-$pkgver"
options="!check" # fail on builders

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
	  CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
	      -DCMAKE_BUILD_TYPE=MinSizeRel \
	      -DCMAKE_INSTALL_PREFIX=/usr \
	      -DALPINE_LINUX=True \
	      $CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	./build/test/test_big
	./build/test/test_ctsdb
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}


sha512sums="
fdc03a05c4d367823e4fed474be2a7d7ff3455e8859eaa11839e1d195e84a8097f8bf3849b0d048d556fb2dbd624f1013814137183616deb5941dfd4b0159f8f  bigbang-0.0.4.tar.gz
cfc989960f59de959a1d1acefd8abff347c5a9ef3e834a01828ab9ee8c4ba392b4d363aeb667de472b44a16e2ffe25f978b67d0968be85d781f9f9fd0569d41f  cmakelists.patch
9968f3c0c1dfb4aa164ea07533c7636210ddc6cb2565348de60b6caf9fbfa33bad2e7e14c22464e3001c641db0a9cc875a3176b52ff79c7149468d90be63be04  gcc11.patch
e1c862c575575c345d48148e37624beeed343098d3a99cc3ccfbf686c2c7b1b1a8ef236dd1fe0128b44ddd06d1b96b6083be45d1b88cf3cce8ae7a10aa67fbd4  werror.patch
"
